package day11.part2;

/**
 * @Author juzipi
 * @Date 2021/6/27 15:54
 * @Info
 */
public class Cylinder extends Circle {

    private double length;

    public Cylinder(){
        this.length = 1.0;
    }

    public double getLength() {
        return length;
    }

    public void setLength(double length) {
        this.length = length;
    }

    //圆柱体面积
    public double getVolume(){
//        super
        return Math.PI * getRadius() * getRadius() * getLength();
    }

    //表面积
    @Override
    public double getArea() {
        //2πr2 + 2πrh  圆柱体表面积公式
        return Math.PI * getRadius() * getRadius() * 2 + 2 * Math.PI * getRadius() * getLength();
    }

}
